package com.mnyc.research.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.mnyc.common.annotation.Log;
import com.mnyc.common.core.controller.BaseController;
import com.mnyc.common.core.domain.AjaxResult;
import com.mnyc.common.enums.BusinessType;
import com.mnyc.research.domain.JySchoolResearch;
import com.mnyc.research.service.IJySchoolResearchService;
import com.mnyc.common.utils.poi.ExcelUtil;
import com.mnyc.common.core.page.TableDataInfo;

/**
 *  校本教研Controller
 * 
 * @author ruoyi
 * @date 2025-08-06
 */
@RestController
@RequestMapping("/research/jySchoolResearch")
public class JySchoolResearchController extends BaseController
{
    @Autowired
    private IJySchoolResearchService jySchoolResearchService;

    /**
     * 查询 校本教研列表
     */
    @PreAuthorize("@ss.hasPermi('research:jySchoolResearch:list')")
    @GetMapping("/list")
    public TableDataInfo list(JySchoolResearch jySchoolResearch)
    {
        startPage();
        List<JySchoolResearch> list = jySchoolResearchService.selectJySchoolResearchList(jySchoolResearch);
        return getDataTable(list);
    }

    /**
     * 导出 校本教研列表
     */
    @PreAuthorize("@ss.hasPermi('research:jySchoolResearch:export')")
    @Log(title = " 校本教研", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, JySchoolResearch jySchoolResearch)
    {
        List<JySchoolResearch> list = jySchoolResearchService.selectJySchoolResearchList(jySchoolResearch);
        ExcelUtil<JySchoolResearch> util = new ExcelUtil<JySchoolResearch>(JySchoolResearch.class);
        util.exportExcel(response, list, " 校本教研数据");
    }

    /**
     * 获取 校本教研详细信息
     */
    @PreAuthorize("@ss.hasPermi('research:jySchoolResearch:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(jySchoolResearchService.selectJySchoolResearchById(id));
    }

    /**
     * 新增 校本教研
     */
    @PreAuthorize("@ss.hasPermi('research:jySchoolResearch:add')")
    @Log(title = " 校本教研", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody JySchoolResearch jySchoolResearch)
    {
        return toAjax(jySchoolResearchService.insertJySchoolResearch(jySchoolResearch));
    }

    /**
     * 修改 校本教研
     */
    @PreAuthorize("@ss.hasPermi('research:jySchoolResearch:edit')")
    @Log(title = " 校本教研", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody JySchoolResearch jySchoolResearch)
    {
        return toAjax(jySchoolResearchService.updateJySchoolResearch(jySchoolResearch));
    }

    /**
     * 删除 校本教研
     */
    @PreAuthorize("@ss.hasPermi('research:jySchoolResearch:remove')")
    @Log(title = " 校本教研", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(jySchoolResearchService.deleteJySchoolResearchByIds(ids));
    }
}
